<?php


namespace Trawind\Basics\Enums;


/**
 * Class BusinessCode
 * @package Trawind\Basics\Enums
 * @method static TOKEN_EXPIRED
 * @method static NO_PERMISSION
 * @method static PARAMETER_ERROR
 * @method static NOT_FOUND_ERROR
 * @method static LOGICAL_ERROR
 * @method static SYSTEM_ERROR
 * @method static REQUEST_OK
 * @method static CREATED_OK
 * @method static UPDATED_OK
 * @method static DELETED_OK
 */
final class BusinessCode extends BaseEnumerate
{

    //https://thoughts.aliyun.com/workspaces/601386cae6ce80001f6cb3f6/docs/6078efb7e87e05000192045e
    const TOKEN_EXPIRED = 40001;
    const NO_PERMISSION = 40002;
    const PARAMETER_ERROR = 40003;
    const NOT_FOUND_ERROR = 40004;
    const SYSTEM_ERROR = 40005;
    const LOGICAL_ERROR = 40006;
    const LOGICAL_WARNING_ERROR = 40007;

    const REQUEST_OK = 20000;
    const CREATED_OK = 20001;
    const UPDATED_OK = 20002;
    const DELETED_OK = 20003;

    const ABNORMAL_OK = 30001;

    const MESSAGE_MAP = [
        self::TOKEN_EXPIRED => 'token_expired',
        self::NO_PERMISSION => 'no_permission',
        self::PARAMETER_ERROR => 'parameter_error',
        self::NOT_FOUND_ERROR => 'not_found_error',
        self::SYSTEM_ERROR => 'system_error',
        self::LOGICAL_ERROR => 'logical_error',
        self::LOGICAL_WARNING_ERROR => 'logical_warning_error',
        self::REQUEST_OK => 'request_ok',
        self::CREATED_OK => 'created_ok',
        self::UPDATED_OK => 'updated_ok',
        self::DELETED_OK => 'deleted_ok',
    ];
}
